import type { NestFilterConditions } from "../type";

export type RevealFieldBase = {
  key: string;
  label: string;
  javascriptType: {
    isBoolean: boolean;
    isTimestamp: boolean;
    isDate: boolean;
  };
  options?: Array<{ label: string; value: string | number }>;
};

export interface RevealProps<V extends RevealFieldBase> {
  conditions?: NestFilterConditions;
  texts?: Array<string>;
  fields: Array<V>;
  tailSlot?: React.ReactNode;
  onTextsChange?: (texts: Array<string>) => void;
  onConditionsChange?: (v: NestFilterConditions) => void;
}

export interface ConditionsProps<V extends RevealFieldBase> {
  fields: Array<V>;
  conditions?: NestFilterConditions;
  tailSlot?: React.ReactNode;
  onChange?: (conditions: NestFilterConditions) => void;
}

export interface ConditionItemProps {
  isFirst?: boolean;
  joint: string;
  fieldKey: string;
  oper: string;
  value:
    | string
    | number
    | boolean
    | Array<string | number | boolean | undefined>
    | undefined;
  onClose: () => void;
}
